home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / BoxIn wipe.c next >
Text File  |  1993-08-23  |  2KB  |  59 lines

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define VBarGap 10
  15. #define HBarGap (VBarGap*MAIN_WINDOW_HEIGHT/MAIN_WINDOW_WIDTH)
  16. #define CorrectTime 3
  17.  
  18. void BoxInWipe(GrafPtr);
  19.  
  20. /* Basically, there are four bars -- one starts at the top and moves down;
  21.    one starts at the bottom and moves up; one starts at the left and moves
  22.    right; one starts at the right and moves left.  There's a lot of overlap
  23.    of bitcopying, but it's masked by the timing correction */
  24.    
  25. void BoxInWipe(GrafPtr sourceGrafPtr)
  26. {
  27.     Rect        vsource1,vsource2, hsource1, hsource2;
  28.     int            vbar,hbar;
  29.     
  30.     vbar=0;
  31.     hbar=0;
  32.     vsource1.top=vsource2.top=hsource2.left=hsource1.left=0;  /* these */
  33.     vsource1.bottom=vsource2.bottom=MAIN_WINDOW_HEIGHT;       /* never */
  34.     hsource1.right=hsource2.right=MAIN_WINDOW_WIDTH;          /* change */
  35.     while (vbar<MAIN_WINDOW_WIDTH/2+VBarGap)
  36.     {
  37.         StartTiming();
  38.         vsource1.left=vbar;
  39.         vsource1.right=vsource1.left+VBarGap;
  40.         vsource2.right=MAIN_WINDOW_WIDTH-vbar;
  41.         vsource2.left=vsource2.right-VBarGap;
  42.         hsource1.top=hbar;
  43.         hsource1.bottom=hsource1.top+HBarGap;
  44.         hsource2.bottom=MAIN_WINDOW_HEIGHT-hbar;
  45.         hsource2.top=hsource2.bottom-HBarGap;
  46.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  47.             &vsource1, &vsource1, 0, 0L);
  48.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  49.             &hsource1, &hsource1, 0, 0L);
  50.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  51.             &vsource2, &vsource2, 0, 0L);
  52.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  53.             &hsource2, &hsource2, 0, 0L);
  54.         vbar+=VBarGap;
  55.         hbar+=HBarGap;
  56.         TimeCorrection(CorrectTime);
  57.     }
  58. }
  59.